#pragma once
#include "Display.h"
#include <Windows.h>
#include "common.h"

class DisplayGdi : public Display
{
public:
    DisplayGdi();
    ~DisplayGdi();
    // 绑定
    long Bind(long _hwnd, long render_type) override;
    // 解绑
    long UnBind() override;

    virtual bool requestCapture(int x1, int y1, int w, int h, cv::Mat &img) override;

private:
    HWND _hwnd;
    // 设备句柄
    HDC _hdc = NULL;
    int _device_caps = 0;
    HDC _hmdc = NULL;
    // 位图句柄
    HBITMAP _hbmpscreen = NULL;
    HBITMAP _hbmp_old = NULL;
    // bmp 文件头
    BITMAPFILEHEADER _bfh = {0};
    BITMAPINFOHEADER _bih = {0}; // 位图信息头
    int dx_, dy_;                // 去除标题栏
    // bytearray temp_src;
    // FrameInfo m_frameInfo;
    // void fmtFrameInfo(void *dst, HWND hwnd, int w, int h);
};